<?php

namespace app\admin\validate;

use think\Validate;
use app\common\Error;

class Money extends Validate
{
    protected $rule = [
        'id' => 'require',
        'name' => 'require',
        // 'label' => 'require',
        'display_object' => 'require',
        'recharge_price' => 'require',
        'send_currency' => 'require',
        'sum_currency' => 'require',
        'send_title' => 'require',
        'platform_type' => 'require',
        'type' => 'require',
        'recharge_name' => 'require',
        'recharge_name' => 'max:30',
        'recharge_day' => 'require',
        'recharge_day' => 'between:1,30',
        'recharge_amount' => 'require',
        'recharge_set' => 'require',
        'video_id' => 'require',
        'limit' => 'between:1,100'
    ];

    protected $message = [
        'id.require' => Error::ID_NOT_EXIXTS,
        'name.require' => Error::NAME_NOT_EXIXTS,
        // 'label.require' => Error::LABEL_NOT_EXIXTS,
        'display_object.require' => Error::DISPLAY_OBJECT_NOT_EXIXTS,
        'recharge_price.require' => Error::RECHARGE_PRICE_NOT_EXIXTS,
        'send_currency.require' => Error::SEND_CURRENCY_NOT_EXIXTS,
        'sum_currency.require' => Error::SUM_CURRENCY_NOT_EXIXTS,
        'send_title.require' => Error::SEND_TITLE_NOT_EXIXTS,
        'platform_type.require' => Error::PLATFORM_TYPE_NOT_EXIXTS,
        'type.require' => Error::PLEASE_SELECT_RECHARGE_TYPE,
        'recharge_name.require' => '充值限制名称不能为空',
        'recharge_name.max' => '充值限制名称参数不能超过30个字符',
        'recharge_day.require' => '限制天数不能为空',
        'recharge_day.between' => '限制天数只能在1-30之间',
        'recharge_amount.require' => '限制金额不能为空',
        'recharge_set.require' => '限制集数不能为空',
        'video_id.require' => '短剧ID不能为空',
        'limit.between' => '内容条数只能在1-100之间'
    ];

    protected $scene = [
        'add' => ['name', 'display_object', 'recharge_price', 'send_currency', 'send_title', 'platform_type, type'],
        'edit' => ['id', 'name', 'display_object', 'recharge_price', 'send_currency', 'send_title', 'platform_type, type'],
        'delete' => ['id'],
        'detail' => ['id'],
        'get_recharge_template_limit' => ['limit'],
        'add_recharge_template_limit' => ['recharge_name', 'recharge_day', 'recharge_amount', 'recharge_set'],
        'delete_recharge_template_limit' => ['id'],
        'update_recharge_template_limit' => ['id'],
        'update_recharge_template_limit_video' => ['video_id'],
        'get_recharge_template_limit_detail' => ['id'],
        'get_recharge_template_limit_video_detail' => ['video_id']
    ];
}
